﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CCWin;

namespace BS_2
{
    public partial class Form_PlanexyzChange : CCWin.Skin_Mac
    {
        private string[] str;
        private Form1 f;
        public Form_PlanexyzChange(string[] str,Form1 f)
        {
            this.str = str;
            this.f = f;
            InitializeComponent();
        }

        private void Form_PlanexyzChange_Load(object sender, EventArgs e)
        {
            skinTextBox1.Text = str[1];
            skinTextBox2.Text = str[2];
            skinTextBox3.Text = str[3];
        }

        private void skinButton1_Click(object sender, EventArgs e)
        {
            if(skinTextBox1.Text == str[1] && skinTextBox2.Text == str[2] && skinTextBox3.Text == str[3])
            {
                MessageBoxEx.Show("您还未做任何修改!");
            }
            else
            {
                int index = f.skinComboBox1.SelectedIndex + 1;
                MessageBox.Show(index.ToString());
                string sql = "update plane set x ="+skinTextBox1.Text+", y ="+skinTextBox2.Text+", z="+ skinTextBox3.Text+" where id="+index+" and pointtype='"+str[0]+"'";
                
                int i = DataAccess.Run_SQL(sql);
                if (i != 0)
                {
                    f.PicTable();
                    f.SectionPlanShow(f.dicpath);
                    this.Close();
                    MessageBoxEx.Show("修改成功！");
                }
                else
                {
                    MessageBoxEx.Show("修改失败！");
                }
                
            }
        }
    }
}
